package com.itheima.day05;

public class printArray {
    public static void main(String[] args) {
        int[]arr={11,22,33,44,55};
        printArray1(arr);
    }

    public static void printArray1(int[]arr) {
        System.out.print("[");
        for (int i = 0; i < arr.length; i++) {
            //满足条件说明最后一个元素,最后一个单独打印
            if (i == arr.length-1){
                System.out.println(arr[i]+"]");
            }else{
                //遍历数组不换行
                System.out.print(arr[i]+", ");
            }
        }
    }
}
